# -*- coding: utf-8 -*-#
#-------------------------------------------------------------------------------
# 建立者:        潘炎珍  
# Name:         demo04
# Description:
# Author:       98745
# Date:         2019/6/7
#-------------------------------------------------------------------------------

from flask import Flask
from flask import request
from flask import make_response

app=Flask(__name__)
@app.route('/')
def index():
    response=make_response('<p>这是一个响应信息</p>')
    return response

@app.route('/writecookie/<cv>')
def writecookie(cv):
    rep=make_response('<p>cookie已经被设置</p>')
    rep.set_cookie('cv',cv,max_age=20)
    return rep

@app.route('/readcookie')
def readcookie():
    val=request.cookies.get('cv')
    print(val)
    if val==None:
        val='cookie已失效'
    return val

if __name__ == '__main__':
    app.run()